﻿Chenxin.UI.ShowListLoan = Chenxin.extend(Chenxin.UI.PageCommon,{
    autoInitForm:false,
    actionUrl:'/service/logic/ShowListLoan.ashx',
    createSearch:function(){
        return new Chenxin.UI.ShowListLoanSearch({
            scope: this
        });
    },
    createGrid: function() {
        return new Chenxin.UI.ReportGrid({
            actionUrl: this.actionUrl + '?op=search',
            id: 'Loan_table',
            renderTo: 'Loan_table',
            hasCheckBox:false,
            cellBorder: true,
            scope:this,
            pageSize: 100,
            height: 258,
            hasPage:true,
            autoLoad: false,
            modelId:'RecordId',
            columns: {
                RecordId:{
					create:false,
					head:'id'
				},
                ContractCode: {
                    head: '成交编号',
                    width: 130,
                    inTotal: false,
                    captionCol:true
                },
//                LoanCode: {
//                    head: '贷款编号',
//                    width: 100
//                },
                LoanDealMode: {
                    head: '贷款渠道',
                    width: 80,
                    inTotal: false
                },
//                LoanModeInfo: {
//                    head: '贷款情况',
//                    width: 110,
//                    renderer:function(val,c,row){
//                        if(row.Receipt==1&row.Mortgage==0)
//                        {
//                            return '收件收据贷款';
//                        }
//                        else if(row.Mortgage==1)
//                        {
//                            return '转按揭贷款';
//                        }
//                        else if(row.Receipt==0&row.Mortgage==0)
//                        {
//                            return '普通贷款';
//                        }
//                    }
//                },
                LoanDealInfo: {
                    head: '贷款情况',
                    width: 110,
                    inTotal: false
                },
                CustomerName: {
                    head: '主贷人',
                    width: 70,
                    inTotal: false
                },
                IDNum: {
                    head: '身份证',
                    width: 140,
                    inTotal: false
                },
                Address: {
                    head: '房屋地址',
                    width: 250,
                    inTotal: false
                },
                SalePrice_T: {
                    head: '房价',
                    width: 90
                },
                BuildingArea: {
                    head: '面积',
                    width: 80,
                    inTotal: false
                },
                GJJmoney: {
                    head: '公积金贷款金额',
                    width: 100 
                },
                GJJyear: {
                    head: '公积金贷款年限',
                    width: 100,
                    inTotal: false
                },
                SYMoney: {
                    head: '商业贷款金额',
                    width: 100
                },
                SYYear: {
                    head: '商业贷款年限',
                    width: 100,
                    inTotal: false
                },
                LoanXf: {
                    head: '消费贷款金额',
                    width: 100
                },
                LoanXfYear: {
                    head: '消费贷款年限',
                    width: 100,
                    inTotal: false
                },
                LoanSx: {
                    head: '授信贷款金额',
                    width: 100
                },
                LoanSxYear: {
                    head: '授信贷款年限',
                    width: 100,
                    inTotal: false
                },
                LoanZy: {
                    head: '助业贷款金额',
                    width: 100
                },
                LoanZyYear: {
                    head: '助业贷款年限',
                    width: 100,
                    inTotal: false
                },
                ReceiveBank: {
                    head: '受理银行',
                    width: 90,
                    inTotal: false
                },
                SLDate: {
                    head: '受理日期',
                    width: 80,
                    inTotal: false
                },
                BankLoanDate: {
                    head: '合同送',
                    width: 80,
                    inTotal: false
                },
                ReceiveLoanDate: {
                    head: '合同回',
                    width: 80,
                    inTotal: false
                },
                CompleteLoanDate: {
                    head: '材料回',
                    width: 80,
                    inTotal: false
                },
                EstimReportBackDate: {
                    head: '评估报告回',
                    width: 80,
                    inTotal: false
                },
                VoucherToBankDate: {
                    head: '收件收据',
                    width: 80,
                    inTotal: false
                },
                CertificateDate: {
                    head: '抵押证',
                    width: 80,
                    inTotal: false
                },
                BankCompleteDate: {
                    head: '放款',
                    width: 80,
                    inTotal: false
                },
                EvaluateFee: {
                    head: '评估费',
                    width: 50
                },
                EvaluateCorp: {
                    head: '评估公司',
                    width: 80,
                    inTotal: false
                },
                InsuranceFee: {
                    head: '保险费',
                    width: 50
                },
                InsuranceCorp: {
                    head: '保险公司',
                    width: 80,
                    inTotal: false
                },
                AgencyFee: {
                    head: '代理费',
                    width: 50
                },
                OutVouchFee: {
                    head: '担保费',
                    width: 50
                },
//                EmpCompanyName: {
//                    head: '公司',
//                    width: 100
//                },
                EmpDepartName: {
                    head: '部门',
                    width: 80,
                    inTotal: false
                },
                EmployeeName: {
                    head: '业务员',
                    width: 80,
                    inTotal: false
                },
                EmpPhone: {
                    head: '联系电话',
                    width: 100,
                    textModel:true,
                    inTotal: false
                },
                TJPercent: {
                    head: '贷款反奖比例',
                    width: 100,
                    inTotal: false
                },
                TJMoney: {
                    head: '团奖',
                    width: 70
                },
                TJDate: {
                    head: '发奖日期',
                    width: 80,
                    inTotal: false
                }
            }
        });
    },
    loadinfo: function() {
        var _this = this;
        Chenxin.ajax({
            type: "get",
            dataType: "text",
            paramType: 'json',
            async:false,
            url: this.actionUrl,
            data: { op: 'getmodel', modelid: this.currentId },
            onSuccess: function(data, msg) {
                if (data) {
                    _this.currentLoan = data;
                }
            }
        });
    },
    loadLoan: function(callback,scope) {
        var _this = this;
        Chenxin.ajax({
            type: "get",
            dataType: "text",
            paramType: 'json',
            async:false,
            url: '/service/logic/DealLoan.ashx',
            data: { op: 'getmodel1', modelid: this.currentId },
            onSuccess: function(data, msg) {
                _this.currentLoan = data;
                if(callback){
                    callback.call(scope);
                }
            }
        });
    },
    del: function() {
        var _this = this;
        Chenxin.ajax({
            type: "get",
            dataType: "text",
            paramType: 'json',
            async:false,
            url: this.actionUrl,
            data: { op: 'deleteloaninfo', modelid: this.currentId },
            onSuccess: function(data, msg) {
                alert("撤销成功！");
                 _this.grid.reload();
            }
        });
    },
    res: function() {
        var _this = this;
        Chenxin.ajax({
            type: "get",
            dataType: "text",
            paramType: 'json',
            async:false,
            url: this.actionUrl,
            data: { op: 'resumeloaninfo', modelid: this.currentId },
            onSuccess: function(data, msg) {
                 alert("恢复成功！");
                 _this.grid.reload();
            }
        });
    },
    initEvent:function(){
        var objLoan = this;
        /*************************事件：起始日期得到焦点************************/
        $("#DateFr").focus(function(){
            WdatePicker({dateFmt:'yyyy-MM-dd',oncleared:function(){$(this).blur();},onpicked:function(){$(this).blur();}})
        });
        /*************************事件：起始日期得到焦点************************/
        $("#DateTo").focus(function(){
            WdatePicker({dateFmt:'yyyy-MM-dd',oncleared:function(){$(this).blur();},onpicked:function(){$(this).blur();}})
        });
        
        /*************************事件：签订贷款合同日期得到焦点************************/
        $("#LoanContractDate").focus(function(){
            WdatePicker({dateFmt:'yyyy-MM-dd',oncleared:function(){$(this).blur();},onpicked:function(){$(this).blur();}})
        });
        
        /*************************事件：受理人修改************************/
//        $("#aUpdSL").click(function(){
//            //受理人输入显示
//            if (objLoan.currentId == null || objLoan.currentId == "") {
//                alert("请先选择一条预审记录！");
//                return;
//            }
//            objLoan.loadLoan(function(){
//                if(objLoan.currentLoan.SLDate == "" || objLoan.currentLoan.SLDate == undefined)
//                {
//                    alert("请先做受理人输入后才可修改！");
//                }
//                else
//                {
//                    window.open("/page/Preliminary_Info/DealLoan.aspx?loanid=" + objLoan.currentId+"");
//                }
//            },this);
//        });
        
        $("#aUpdSL").click(function(){
            //受理人输入显示
            if (objLoan.currentId == null || objLoan.currentId == "") {
                alert("请先选择一条预审记录！");
                return;
            }
            objLoan.loadLoan(function(){
                window.open("/page/Preliminary_Info/DealLoan.aspx?loanid=" + objLoan.currentId+"");
            },this);
        });

        /*************************事件：审核人输入************************/
//        $("#aInputSH").click(function(){
//            //审核人输入显示
//            if (objLoan.currentId == null || objLoan.currentId == "") {
//                alert("请先选择一条记录！");
//                return;
//            }
//            objLoan.loadLoan(function(){
//                if(objLoan.currentLoan.SHDate != null && objLoan.currentLoan.SHDate != "" && objLoan.currentLoan.SHDate != undefined)
//                {
//                    alert("流程中已做审核人输入，只能修改！");
//                }
//                else
//                {
//                    objLoan.SHInput();
//                }
//            },this);
//        });

        $("#aInputSH").click(function(){
            //审核人输入显示
            if (objLoan.currentId == null || objLoan.currentId == "") {
                alert("请先选择一条记录！");
                return;
            }
            objLoan.loadLoan(function(){
                if(objLoan.currentLoan.SHDate != null && objLoan.currentLoan.SHDate != "" && objLoan.currentLoan.SHDate != undefined)
                {
                    objLoan.SHEdit();
                }
                else
                {
                    objLoan.SHInput();
                }
            },this);
        });

//        /*************************事件：审核人修改************************/
//        $("#aUpdSH").click(function(){
//            //审核人输入显示
//            if (objLoan.currentId == null || objLoan.currentId == "") {
//                alert("请先选择一条记录！");
//                return;
//            }
//            objLoan.loadLoan(function(){
//                if(objLoan.currentLoan.SHDate == "" || objLoan.currentLoan.SHDate == undefined || objLoan.currentLoan.SHDate == null)
//                {
//                    alert("请先做审核人输入后才可修改！");
//                }
//                else
//                {
//                    objLoan.SHEdit();
//                }
//            },this);
//        });

        /*************************事件：放款人输入************************/
//        $("#aInputFK").click(function(){
//            //放款人显示
//            if (objLoan.currentId == null || objLoan.currentId == "") {
//                alert("请先选择一条记录！");
//                return;
//            }
//            objLoan.loadLoan(function(){
//                if(objLoan.currentLoan.FKDate != null && objLoan.currentLoan.FKDate != "" && objLoan.currentLoan.FKDate != undefined)
//                {
//                    alert("流程中已做放款人输入，只能修改！");
//                }
//                else
//                {
//                    objLoan.FKInput();
//                }
//            },this);
//        });
        
        $("#aInputFK").click(function(){
            //放款人显示
            if (objLoan.currentId == null || objLoan.currentId == "") {
                alert("请先选择一条记录！");
                return;
            }
            objLoan.loadLoan(function(){
                if(objLoan.currentLoan.FKDate != null && objLoan.currentLoan.FKDate != "" && objLoan.currentLoan.FKDate != undefined)
                {
                    objLoan.FKEdit();
                }
                else
                {
                    objLoan.FKInput();
                }
            },this);
        });

        /*************************事件：放款人修改************************/
//        $("#aUpdFK").click(function(){
//            //放款人显示
//            if (objLoan.currentId == null || objLoan.currentId == "") {
//                alert("请先选择一条记录！");
//                return;
//            }
//            objLoan.loadLoan(function(){
//                if(objLoan.currentLoan.FKDate == "" || objLoan.currentLoan.FKDate == undefined || objLoan.currentLoan.FKDate == null)
//                {
//                    alert("请先做放款人输入后才可修改！");
//                }
//                else
//                {
//                    objLoan.FKEdit();
//                }
//            },this);
//        });
        
        /*************************事件：贷款奖励************************/
        $("#aLoanEncouragement").click(function(){
            //贷款奖励显示
            if (objLoan.currentId == null || objLoan.currentId == "") {
                alert("请先选择一条贷款记录！");
                return;
            }
            objLoan.loadinfo();
            objLoan.showLoanEncouragement();
        });
        
        /*************************事件：详情查看************************/
        $("#aShowDetail").click(function(){
            //详情查看复显示
            if (objLoan.currentId == null || objLoan.currentId == "") {
                alert("请先选择一条贷款记录！");
                return;
            }
//            Chenxin.Fn.checkPermit(objLoan.actionUrl,'viewloan',function(data,msg){
//			    if(data.permit!=undefined){
//				    objLoan.permit=data.permit;	
//				    objLoan.msg = msg;
//			    }
//		    },this,{ modelid: objLoan.currentId });
//		    if(objLoan.permit){			
//                window.open("/page/Preliminary_Info/ShowDetailLoan.aspx?recordid="+objLoan.currentId+"");
//		    }else{
//			    alert(objLoan.msg);
//		    }
            window.open("/page/Preliminary_Info/ShowDetailLoan.aspx?recordid="+objLoan.currentId+"");
        });
        
        /*************************事件：撤销************************/
        $("#aDelete").live("click",function(){
            if (objLoan.currentId == null || objLoan.currentId == "") {
                alert("请先选择一条贷款记录！");
                return;
            }
            if(confirm("是否撤销该记录！")){
                objLoan.del();
            }
        });

         /*************************事件：恢复************************/
        $("#aResume").live("click",function(){
            if (objLoan.currentId == null || objLoan.currentId == "") {
                alert("请先选择一条贷款记录！");
                return;
            }
            if(confirm("是否恢复该条记录！")){
                objLoan.res();
            }
        });
    },
    /**
    *审核输入
    */
    SHInput: function() {
        var _this = this;
        if (!this.SHInputForm) {
            this.SHInputForm = new Chenxin.UI.SHInputForm({
                scope: _this,
                alwaysCheckPermit: true,
                afterGetFormJson:function(json){
                    delete json.Address;
                    delete json.EmpCompanyId;
                    delete json.EmpDepartId;
                    delete json.EmployeeId;
                    delete json.OperateCompanyId;
                    delete json.OperateDepartId;
                    delete json.OperateUserId;
                    delete json.LoanCode;
                    delete json.LoanInfo;
                    delete json.LoanDealMode;
                    delete json.EvaluateCorp;
                    delete json.InsuranceCorp;
                    delete json.LackInfo;
                    delete json.ReceiveBank;
                    delete json.LoanXfYear;
                    delete json.LoanSxYear;
                    delete json.LoanZyYear;
                    delete json.SalerPhone;
                    delete json.BuyerPhone;
                    delete json.CustomerName;
                    delete json.IDNum;
                    delete json.GJJyear;
                    delete json.SYYear;
                    delete json.OrderPlace;
                    delete json.SaleName;
                    delete json.SaleIDCard;
                    delete json.OldLoanBank;
                    delete json.EmpCompanyName;
                    delete json.EmpDepartName;
                    delete json.EmployeeName;
                    delete json.EmpPhone;
                    delete json.OperateCompanyName;
                    delete json.OperateDepartName;
                    delete json.OperateUserName;
                    delete json.SLRemark;
                    delete json.FKRemark;
                    delete json.EvaluateFee;
                    delete json.InsuranceFee;
                    delete json.AgencyFee;
                    delete json.OutVouchFee;
                    delete json.VouchFee;
                    delete json.LoanXf;
                    delete json.LoanSx;
                    delete json.LoanZy;
                    delete json.BankQueryFee;
                    delete json.BankManageFee;
                    delete json.LoanBankSaleComplete;
                    delete json.EstimatePrice;
                    delete json.GJJmoney;
                    delete json.SYMoney;
                    delete json.OldLoanMoney;
                    delete json.OldRestMoney;
                    delete json.BuildingArea;
                    delete json.LoanContractDate;
                    delete json.MortgageClearDate;
                    delete json.LoanComplete;
                    delete json.SendToBankDate;
                    delete json.VoucherToBankDate;
                    delete json.CertificateDate;
                    delete json.BankCompleteDate;
                    delete json.SLDate;
                    delete json.SHDate;
                    delete json.FKDate;
                    delete json.UpSLDate;
                    delete json.UpSHDate;
                    delete json.UpFKDate;
                    delete json.EvaluateFeeDate;
                    delete json.VouchFeeDate;
                    delete json.InsuranceFeeDate;
                    delete json.AgencyFeeDate;
                    delete json.OutVouchFeeDate;
                    delete json.EndDate;
                    delete json.CompleteLoanDate;
                    delete json.IsNoEvaluateFee;
                    delete json.IdBankReceipt;
                    delete json.IdZhuanBen;
                    delete json.IsNoAgencyFee;
                    delete json.IdShouBen;
                    delete json.IsLack;
                    delete json.Receipt;
                    delete json.Mortgage;
                    delete json.Status;
                    delete json.CompleteYear;
                    delete json.Total_Floor;
                },
                saveSucc:function(){
                    _this.grid.reload();
                    _this.currentId=null;
			    }
            });
        }
        this.SHInputForm.op = "inputsh";
        if(this.SHInputForm.show(this.SHInputForm.op, { modelid: _this.currentId })) {
            this.SHInputForm.reset();
            this.SHInputForm.fitData({
                RecordId:this.currentId
            });
            
            var _data = this.currentLoan;
            this.SHInputForm.fitData(_data);
            this.SHInputForm.setTitle('审核输入');
        }else{
            alert('abc');
        }
    },
    
    /**
    *审核修改
    */
    SHEdit: function() {
        var _this = this;
        
        if (!this.SHInputForm) {
            this.SHInputForm = new Chenxin.UI.SHInputForm({
                scope: _this,
                alwaysCheckPermit: true,
                afterGetFormJson:function(json){
                    delete json.Address;
                    delete json.EmpCompanyId;
                    delete json.EmpDepartId;
                    delete json.EmployeeId;
                    delete json.OperateCompanyId;
                    delete json.OperateDepartId;
                    delete json.OperateUserId;
                    delete json.LoanCode;
                    delete json.LoanInfo;
                    delete json.LoanDealMode;
                    delete json.EvaluateCorp;
                    delete json.InsuranceCorp;
                    delete json.LackInfo;
                    delete json.ReceiveBank;
                    delete json.LoanXfYear;
                    delete json.LoanSxYear;
                    delete json.LoanZyYear;
                    delete json.SalerPhone;
                    delete json.BuyerPhone;
                    delete json.CustomerName;
                    delete json.IDNum;
                    delete json.GJJyear;
                    delete json.SYYear;
                    delete json.OrderPlace;
                    delete json.SaleName;
                    delete json.SaleIDCard;
                    delete json.OldLoanBank;
                    delete json.EmpCompanyName;
                    delete json.EmpDepartName;
                    delete json.EmployeeName;
                    delete json.EmpPhone;
                    delete json.OperateCompanyName;
                    delete json.OperateDepartName;
                    delete json.OperateUserName;
                    delete json.SLRemark;
                    delete json.FKRemark;
                    delete json.EvaluateFee;
                    delete json.InsuranceFee;
                    delete json.AgencyFee;
                    delete json.OutVouchFee;
                    delete json.VouchFee;
                    delete json.LoanXf;
                    delete json.LoanSx;
                    delete json.LoanZy;
                    delete json.BankQueryFee;
                    delete json.BankManageFee;
                    delete json.LoanBankSaleComplete;
                    delete json.EstimatePrice;
                    delete json.GJJmoney;
                    delete json.SYMoney;
                    delete json.OldLoanMoney;
                    delete json.OldRestMoney;
                    delete json.BuildingArea;
                    delete json.LoanContractDate;
                    delete json.MortgageClearDate;
                    delete json.LoanComplete;
                    delete json.SendToBankDate;
                    delete json.VoucherToBankDate;
                    delete json.CertificateDate;
                    delete json.BankCompleteDate;
                    delete json.SLDate;
                    delete json.SHDate;
                    delete json.FKDate;
                    delete json.UpSLDate;
                    delete json.UpSHDate;
                    delete json.UpFKDate;
                    delete json.EvaluateFeeDate;
                    delete json.VouchFeeDate;
                    delete json.InsuranceFeeDate;
                    delete json.AgencyFeeDate;
                    delete json.OutVouchFeeDate;
                    delete json.EndDate;
                    delete json.CompleteLoanDate;
                    delete json.IsNoEvaluateFee;
                    delete json.IdBankReceipt;
                    delete json.IdZhuanBen;
                    delete json.IsNoAgencyFee;
                    delete json.IdShouBen;
                    delete json.IsLack;
                    delete json.Receipt;
                    delete json.Mortgage;
                    delete json.Status;
                    delete json.CompleteYear;
                    delete json.Total_Floor;
                },
                saveSucc:function(){
                    _this.grid.reload();
                    _this.currentId=null;
			    }
            });
        }
        this.SHInputForm.op = "updatesh";
        if(this.SHInputForm.show(this.SHInputForm.op, { currentId: _this.currentId })) {
            this.SHInputForm.reset();
            this.SHInputForm.fitData({
                RecordId:this.currentId
            });
            var _data = this.currentLoan;
            this.SHInputForm.fitData(_data);
            this.SHInputForm.setTitle('审核修改');
        }
    },
    
    /**
    *放款输入
    */
    FKInput: function() {
        var _this = this;
        
        if (!this.FKInputForm) {
            this.FKInputForm = new Chenxin.UI.FKInputForm({
                scope: _this,
                alwaysCheckPermit: true,
                afterGetFormJson:function(json){
                    delete json.Address;
                    delete json.EmpCompanyId;
                    delete json.EmpDepartId;
                    delete json.EmployeeId;
                    delete json.OperateCompanyId;
                    delete json.OperateDepartId;
                    delete json.OperateUserId;
                    delete json.LoanCode;
                    delete json.LoanInfo;
                    delete json.LoanDealMode;
                    delete json.EvaluateCorp;
                    delete json.InsuranceCorp;
                    delete json.LackInfo;
                    delete json.ReceiveBank;
                    delete json.LoanXfYear;
                    delete json.LoanSxYear;
                    delete json.LoanZyYear;
                    delete json.SalerPhone;
                    delete json.BuyerPhone;
                    delete json.CustomerName;
                    delete json.IDNum;
                    delete json.GJJyear;
                    delete json.SYYear;
                    delete json.OrderPlace;
                    delete json.SaleName;
                    delete json.SaleIDCard;
                    delete json.OldLoanBank;
                    delete json.EmpCompanyName;
                    delete json.EmpDepartName;
                    delete json.EmployeeName;
                    delete json.EmpPhone;
                    delete json.OperateCompanyName;
                    delete json.OperateDepartName;
                    delete json.OperateUserName;
                    delete json.SLRemark;
                    delete json.SHRemark;
                    delete json.EvaluateFee;
                    delete json.InsuranceFee;
                    delete json.AgencyFee;
                    delete json.OutVouchFee;
                    delete json.VouchFee;
                    delete json.LoanXf;
                    delete json.LoanSx;
                    delete json.LoanZy;
                    delete json.BankQueryFee;
                    delete json.BankManageFee;
                    delete json.LoanBankSaleComplete;
                    delete json.EstimatePrice;
                    delete json.GJJmoney;
                    delete json.SYMoney;
                    delete json.OldLoanMoney;
                    delete json.OldRestMoney;
                    delete json.BuildingArea;
                    delete json.LoanContractDate;
                    delete json.MortgageClearDate;
                    delete json.LoanComplete;
                    delete json.BankLoanDate;
                    delete json.ReceiveLoanDate;
                    delete json.SendToBankDate;
                    delete json.SLDate;
                    delete json.SHDate;
                    delete json.FKDate;
                    delete json.UpSLDate;
                    delete json.UpSHDate;
                    delete json.UpFKDate;
                    delete json.EvaluateFeeDate;
                    delete json.VouchFeeDate;
                    delete json.InsuranceFeeDate;
                    delete json.AgencyFeeDate;
                    delete json.OutVouchFeeDate;
                    delete json.EndDate;
                    delete json.EstimReportBackDate;
                    delete json.IsNoEvaluateFee;
                    delete json.IdBankReceipt;
                    delete json.IdZhuanBen;
                    delete json.IsNoAgencyFee;
                    delete json.IdShouBen;
                    delete json.IsLack;
                    delete json.Receipt;
                    delete json.Mortgage;
                    delete json.Status;
                    delete json.CompleteYear;
                    delete json.Total_Floor;
                },
                saveSucc:function(){
                    _this.grid.reload();
                    _this.currentId=null;
			    }
            });
        }
        this.FKInputForm.op = "inputfk";
        if(this.FKInputForm.show(this.FKInputForm.op, { currentId: _this.currentId })) {
            this.FKInputForm.reset();
            this.FKInputForm.fitData({
                RecordId:this.currentId
            });
            var _data = this.currentLoan;
            this.FKInputForm.fitData(_data);
            this.FKInputForm.setTitle('放款输入');
        }
    },
    
    /**
    *放款修改
    */
    FKEdit: function() {
        var _this = this;
        
        if (!this.FKInputForm) {
            this.FKInputForm = new Chenxin.UI.FKInputForm({
                scope: _this,
                alwaysCheckPermit: true,
                afterGetFormJson:function(json){
                    delete json.Address;
                    delete json.EmpCompanyId;
                    delete json.EmpDepartId;
                    delete json.EmployeeId;
                    delete json.OperateCompanyId;
                    delete json.OperateDepartId;
                    delete json.OperateUserId;
                    delete json.LoanCode;
                    delete json.LoanInfo;
                    delete json.LoanDealMode;
                    delete json.EvaluateCorp;
                    delete json.InsuranceCorp;
                    delete json.LackInfo;
                    delete json.ReceiveBank;
                    delete json.LoanXfYear;
                    delete json.LoanSxYear;
                    delete json.LoanZyYear;
                    delete json.SalerPhone;
                    delete json.BuyerPhone;
                    delete json.CustomerName;
                    delete json.IDNum;
                    delete json.GJJyear;
                    delete json.SYYear;
                    delete json.OrderPlace;
                    delete json.SaleName;
                    delete json.SaleIDCard;
                    delete json.OldLoanBank;
                    delete json.EmpCompanyName;
                    delete json.EmpDepartName;
                    delete json.EmployeeName;
                    delete json.EmpPhone;
                    delete json.OperateCompanyName;
                    delete json.OperateDepartName;
                    delete json.OperateUserName;
                    delete json.SLRemark;
                    delete json.SHRemark;
                    delete json.EvaluateFee;
                    delete json.InsuranceFee;
                    delete json.AgencyFee;
                    delete json.OutVouchFee;
                    delete json.VouchFee;
                    delete json.LoanXf;
                    delete json.LoanSx;
                    delete json.LoanZy;
                    delete json.BankQueryFee;
                    delete json.BankManageFee;
                    delete json.LoanBankSaleComplete;
                    delete json.EstimatePrice;
                    delete json.GJJmoney;
                    delete json.SYMoney;
                    delete json.OldLoanMoney;
                    delete json.OldRestMoney;
                    delete json.BuildingArea;
                    delete json.LoanContractDate;
                    delete json.MortgageClearDate;
                    delete json.LoanComplete;
                    delete json.BankLoanDate;
                    delete json.ReceiveLoanDate;
                    delete json.SendToBankDate;
                    delete json.SLDate;
                    delete json.SHDate;
                    delete json.FKDate;
                    delete json.UpSLDate;
                    delete json.UpSHDate;
                    delete json.UpFKDate;
                    delete json.EvaluateFeeDate;
                    delete json.VouchFeeDate;
                    delete json.InsuranceFeeDate;
                    delete json.AgencyFeeDate;
                    delete json.OutVouchFeeDate;
                    delete json.EndDate;
                    delete json.EstimReportBackDate;
                    delete json.IsNoEvaluateFee;
                    delete json.IdBankReceipt;
                    delete json.IdZhuanBen;
                    delete json.IsNoAgencyFee;
                    delete json.IdShouBen;
                    delete json.IsLack;
                    delete json.Receipt;
                    delete json.Mortgage;
                    delete json.Status;
                    delete json.CompleteYear;
                    delete json.Total_Floor;
                },
                saveSucc:function(){
                    _this.grid.reload();
                    _this.currentId=null;
			    }
            });
        }
        this.FKInputForm.op = "updatefk";
        if(this.FKInputForm.show(this.FKInputForm.op, { currentId: _this.currentId })) {
            this.FKInputForm.reset();
            this.FKInputForm.fitData({
                RecordId:this.currentId
            });
            var _data = this.currentLoan;
            this.FKInputForm.fitData(_data);
            this.FKInputForm.setTitle('放款修改');
        }
    },
    /**
    *贷款奖励
    */
    showLoanEncouragement:function(){
        var _this = this;
        if (!this.LoanEncouragementForm) {
            this.LoanEncouragementForm = new Chenxin.UI.LoanEncouragementForm({
                scrop: _this,
                alwaysCheckPermit: true,
                afterGetFormJson:function(json){
                    delete json.MainId;
                    delete json.EmpCompanyId;
                    delete json.EmpDepartId;
                    delete json.EmployeeId;
                    delete json.OperateCompanyId;
                    delete json.OperateDepartId;
                    delete json.OperateUserId;
                    delete json.ContractId;
                    delete json.LoanCode;
                    delete json.LoanInfo;
                    delete json.LoanDealMode;
                    delete json.ContractCode;
                    delete json.EvaluateCorp;
                    delete json.InsuranceCorp;
                    delete json.ReceiveBank;
                    delete json.LoanXfYear;
                    delete json.LoanSxYear;
                    delete json.LoanZyYear;
                    delete json.SalerPhone;
                    delete json.BuyerPhone;
                    delete json.CustomerName;
                    delete json.IDNum;
                    delete json.GJJyear;
                    delete json.SYYear;
                    delete json.OrderPlace;
                    delete json.SaleName;
                    delete json.SaleIDCard;
                    delete json.OldLoanBank;
                    delete json.EmpCompanyName;
                    delete json.EmpDepartName;
                    delete json.EmployeeName;
                    delete json.EmpPhone;
                    delete json.OperateCompanyName;
                    delete json.OperateDepartName;
                    delete json.OperateUserName;
                    delete json.Address;
                    delete json.LackInfo;
                    delete json.Remark;
                    delete json.SLRemark;
                    delete json.SHRemark;
                    delete json.FKRemark;
                    delete json.EvaluateFee;
                    delete json.InsuranceFee;
                    delete json.AgencyFee;
                    delete json.OutVouchFee;
                    delete json.VouchFee;
                    delete json.LoanXf;
                    delete json.LoanSx;
                    delete json.LoanZy;
                    delete json.BankQueryFee;
                    delete json.BankManageFee;
                    delete json.LoanBankSaleComplete;
                    delete json.EstimatePrice;
                    delete json.GJJmoney;
                    delete json.SYMoney;
                    delete json.OldLoanMoney;
                    delete json.OldRestMoney;
                    delete json.BuildingArea;
                    delete json.LoanContractDate;
                    delete json.MortgageClearDate;
                    delete json.LoanComplete;
                    delete json.BankLoanDate;
                    delete json.ReceiveLoanDate;
                    delete json.SendToBankDate;
                    delete json.VoucherToBankDate;
                    delete json.CertificateDate;
                    delete json.BankCompleteDate;
                    delete json.SLDate;
                    delete json.SHDate;
                    delete json.FKDate;
                    delete json.UpSLDate;
                    delete json.UpSHDate;
                    delete json.UpFKDate;
                    delete json.EvaluateFeeDate;
                    delete json.VouchFeeDate;
                    delete json.InsuranceFeeDate;
                    delete json.AgencyFeeDate;
                    delete json.OutVouchFeeDate;
                    delete json.EndDate;
                    delete json.EstimReportBackDate;
                    delete json.CompleteLoanDate;
                    delete json.IsNoEvaluateFee;
                    delete json.IdBankReceipt;
                    delete json.IdZhuanBen;
                    delete json.IsNoAgencyFee;
                    delete json.IdShouBen;
                    delete json.IsLack;
                    delete json.Receipt;
                    delete json.Mortgage;
                    delete json.Status;
                    delete json.CompleteYear;
                    delete json.Total_Floor;
                },
                saveSucc:function(){
                    _this.grid.reload();
                    _this.currentId=null;
			    }
            });
        }
        this.LoanEncouragementForm.op = "loanencouragement";
        if(this.LoanEncouragementForm.show(this.LoanEncouragementForm.op, { currentId: _this.currentId })) {
            this.LoanEncouragementForm.reset();
            var _data = this.currentLoan;
            this.LoanEncouragementForm.fitData(_data);
            this.LoanEncouragementForm.setTitle('贷款奖励');
        }
    }
});

/**
*查询面板
*/
Chenxin.UI.ShowListLoanSearch=Chenxin.extend(Chenxin.UI.SearchCommon,{
    id:'Loan_search',
    initEvent:function(){
        var _this=this; 
        
        //导出Excel
        $('#aExportExcel').click(function() {
            _this.exportData();
        });

        //查询按钮
        $('#btSreachLoan').click(function(){
              _this.scope.searchGrid();
        });
        
        $('#KeyWord').defText({
            deftxt: '请输入地址或客户姓名或受理银行'
        });
        
        var curdate = new Date();
        $('#DateFr').val(curdate.getFullYear() + '-' + (curdate.getMonth() + 1) + '-1');
        if (curdate.getMonth() + 1 == 12)
            $('#DateTo').val(curdate.getFullYear() + 1 + '-1-1');
        else
            $('#DateTo').val(curdate.getFullYear() + '-' + (curdate.getMonth() + 2) + '-1');
    },
    createComboList: function(){
        //贷款情况
        var comboLoanType= new Chenxin.UI.Combo({
            containerId: '#LoanInfo',
            name: 'LoanInfo',
            tbxWidth: 100,
            colWidth:80,
            required:true,
            items:comboCommon.LoanInfo
        });
        
        //日期查询类型
        var ComboDateType = new Chenxin.UI.Combo({
            containerId: '#DateType',
            tbxWidth: 70,
            colWidth: 110,
            items: comboCommon.LoanDateType
        });
        
        //贷款情况
        var comboLoanStatus= new Chenxin.UI.Combo({
            containerId: '#Status',
            name: 'Status',
            tbxWidth: 80,
            colWidth:80,
            required:true,
            items:comboCommon.LoanStatus
        });
        
        //五级联Combo
        var combl = new Chenxin.UI.StructComboList();
        var structs = combl.comboList;
        structs.push(ComboDateType);
        structs.push(comboLoanType);
        structs.push(comboLoanStatus);
        return structs;
    },
    initComponent: function() {
        Chenxin.UI.ShowListLoanSearch.superclass.initComponent.call(this);
    }
});

getcity = true; //设置需要获取城市下拉框数据

$(document).ready(function(){
    var showlistloan = new Chenxin.UI.ShowListLoan();
});